/**
 */
package fUML.Semantics.CommonBehaviors.BasicBehaviors;

import fUML.Syntax.Classes.Kernel.Parameter;

import fUML.Syntax.CommonBehaviors.BasicBehaviors.Behavior;

import org.eclipse.emf.common.util.EList;

/**
 * <!-- begin-user-doc -->
 * A representation of the model object '<em><b>Execution</b></em>'.
 * <!-- end-user-doc -->
 *
 * <!-- begin-model-doc -->
 * An execution is used to execute a specific behavior. Since a behavior is a kind
 *                 of class, an execution is an object with the behavior as its type.
 * <!-- end-model-doc -->
 *
 * <p>
 * The following features are supported:
 * <ul>
 *   <li>{@link fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution#getContext <em>Context</em>}</li>
 *   <li>{@link fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution#getParameterValues <em>Parameter Values</em>}</li>
 * </ul>
 * </p>
 *
 * @see fUML.Semantics.CommonBehaviors.BasicBehaviors.BasicBehaviorsPackage#getExecution()
 * @model abstract="true"
 * @generated
 */
public interface Execution extends fUML.Semantics.Classes.Kernel.Object {
	/**
	 * Returns the value of the '<em><b>Context</b></em>' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * The object that provides the context for this execution. 
	 *  The type of
	 *                   the context of the execution must be the context of the type (behavior) of the
	 *                   execution.
	 * <!-- end-model-doc -->
	 * @return the value of the '<em>Context</em>' reference.
	 * @see #setContext(fUML.Semantics.Classes.Kernel.Object)
	 * @see fUML.Semantics.CommonBehaviors.BasicBehaviors.BasicBehaviorsPackage#getExecution_Context()
	 * @model required="true" ordered="false"
	 * @generated
	 */
	fUML.Semantics.Classes.Kernel.Object getContext();

	/**
	 * Sets the value of the '{@link fUML.Semantics.CommonBehaviors.BasicBehaviors.Execution#getContext <em>Context</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @param value the new value of the '<em>Context</em>' reference.
	 * @see #getContext()
	 * @generated
	 */
	void setContext(fUML.Semantics.Classes.Kernel.Object value);

	/**
	 * Returns the value of the '<em><b>Parameter Values</b></em>' containment reference list.
	 * The list contents are of type {@link fUML.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * The parameterValues for this execution. All parameterValues must have a
	 *                   parameter that is a parameter of the type of this execution.
	 *  The values
	 *                   of all input (in and in-out) parameters must be set before the execution is
	 *                   executed.
	 * <!-- end-model-doc -->
	 * @return the value of the '<em>Parameter Values</em>' containment reference list.
	 * @see fUML.Semantics.CommonBehaviors.BasicBehaviors.BasicBehaviorsPackage#getExecution_ParameterValues()
	 * @model containment="true" ordered="false"
	 * @generated
	 */
	EList<ParameterValue> getParameterValues();

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * Execute the behavior given by the type of this execution. 
	 *  The
	 *                   parameterValues for any input (in or in-out) parameters of the behavior should be
	 *                   set before the execution.
	 *  The parameteValues for any output (in-out, out
	 *                   or return) parameters of the behavior will be set by the execution.
	 *                 
	 * <!-- end-model-doc -->
	 * @model
	 * @generated
	 */
	void execute();

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * // Terminate an ongoing execution. By default, do nothing.
	 *  
	 *                   return;
	 *  
	 * <!-- end-model-doc -->
	 * @model
	 * @generated
	 */
	void terminate();

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * // Set the given parameter value for this execution.
	 *  // If a
	 *                   parameter value already existed for the parameter of the given parameter value,
	 *                   then replace its value.
	 *  
	 *  // Debug.println("[setParameterValue]
	 *                   parameter = " + parameterValue.parameter.name + " with " +
	 *                   parameterValue.values.size() + " values");
	 *  
	 *  ParameterValue
	 *                   existingParameterValue =
	 *                   this.getParameterValue(parameterValue.parameter);
	 *  
	 *  if
	 *                   (existingParameterValue == null) {
	 *                   this.parameterValues.addValue(parameterValue);
	 *  }
	 *  else {
	 *                   existingParameterValue.values = parameterValue.values;
	 *  }
	 *                   
	 *  
	 * <!-- end-model-doc -->
	 * @model parameterValueRequired="true" parameterValueOrdered="false"
	 * @generated
	 */
	void fUML_setParameterValue(ParameterValue parameterValue);

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * // Get the parameter value of this execution corresponding to the given
	 *                   parameter (if any).
	 *  
	 *  ParameterValue parameterValue =
	 *                   null;
	 *  int i = 1;
	 *  while (parameterValue == null & i
	 *                   <= this.parameterValues.size()) {
	 *  if
	 *                   (this.parameterValues.getValue(i-1).parameter == parameter) {
	 *                   parameterValue = this.parameterValues.getValue(i-1);
	 *  }
	 *  i = i +
	 *                   1;
	 *  }
	 *  
	 *  return parameterValue;
	 *  
	 *  
	 * <!-- end-model-doc -->
	 * @model required="true" ordered="false" parameterRequired="true" parameterOrdered="false"
	 * @generated
	 */
	ParameterValue getParameterValue(Parameter parameter);

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * // Return the parameter values for output (in-out, out and return)
	 *                   parameters.
	 *  
	 *  ParameterValueList outputs = new
	 *                   ParameterValueList();
	 *  ParameterValueList parameterValues =
	 *                   this.parameterValues;
	 *  for (int i = 0; i < parameterValues.size();
	 *                   i++) {
	 *  ParameterValue parameterValue =
	 *                   parameterValues.getValue(i);
	 *  Parameter parameter =
	 *                   parameterValue.parameter;
	 *  if ((parameter.direction ==
	 *                   ParameterDirectionKind.inout) |
	 *  (parameter.direction ==
	 *                   ParameterDirectionKind.out) |
	 *  (parameter.direction ==
	 *                   ParameterDirectionKind.return_)) {
	 *                   outputs.addValue(parameterValue);
	 *  }
	 *  }
	 *  
	 *  return
	 *                   outputs;
	 *  
	 * <!-- end-model-doc -->
	 * @model kind="operation" ordered="false"
	 * @generated
	 */
	EList<ParameterValue> getOutputParameterValues();

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * <!-- begin-model-doc -->
	 * // Get the behavior that is the type of this execution.
	 *  
	 *                   return (Behavior)(this.getTypes().getValue(0));
	 * <!-- end-model-doc -->
	 * @model kind="operation" required="true" ordered="false"
	 * @generated
	 */
	Behavior getBehavior();

} // Execution
